from GameObject import *


class Character(GameObject):
    """This is a GameObject with heatlh and a facing direction"""
    
    MIN_HEALTH = 0
    MAX_HEALTH = 100

    def __init__(self):
        GameObject.__init__(self)

        self.health = Character.MAX_HEALTH
        self.facing = self.RIGHT
        
    def incHealth(self,amount):
        self.health += amount
        if self.health > self.MAX_HEALTH: self.health = self.MAX_HEALTH
   
    def decHealth(self,amount):
        self.health -= amount
        if self.health < self.MIN_HEALTH: self.health = self.MIN_HEALTH        

    def isAlive(self):
        return self.health > self.MIN_HEALTH
    
    def setFacing(self,direction):
        self.facing = direction
